<?php echo '<?xml version="1.0" encoding="UTF-8" ?>'; ?>

<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0" xmlns:c="http://base.google.com/cns/1.0">
<channel>
    <title><?php echo $this->title; ?></title>
    <description><?php echo $this->description; ?></description>
    <link><?php echo $this->websiteUrl; ?>products.xml</link>
    <?php foreach ($this->products as $product): ?>
	<item>
		<title><?php echo $product['title'];?></title>
		<link><?php echo $product['link'];?></link>
		<description><?php echo $product['description'];?></description>
		<pubDate><?php echo date("D, d M Y H:i:s T",  strtotime($product['pubDate'])); ?></pubDate>
		<g:id><?php echo $product['id'];?></g:id>
		<g:price><?php echo $product['price'];?></g:price>
		<g:condition><?php echo $product['condition'];?></g:condition>
		<g:brand><?php echo $product['brand'];?></g:brand>
		<g:image_link><?php echo $product['image_link'];?></g:image_link>
		<g:product_type><?php echo $product['product_type'];?></g:product_type>
		<?php if(!empty($product['mpn'])): ?>
		<g:mpn><?php echo $product['mpn'];?></g:mpn>
		<?php endif; ?>
		<g:featured_product><?php echo $product['featured_product'];?></g:featured_product>
		<?php if(!empty($product['product_review_average'])): ?>
		<g:product_review_average><?php echo $product['product_review_average'];?></g:product_review_average>
		<?php endif; ?>
		<?php if(!empty($product['shipping_weight'])): ?>
		<g:shipping_weight><?php echo $product['shipping_weight'];?> kilograms</g:shipping_weight>
		<?php endif; ?>
		<?php if(!empty($product['regular_price'])): ?>
		<c:regular_price type="float"><?php echo $product['regular_price'];?></c:regular_price>
		<?php endif; ?>
		<?php if(!empty($product['sale_due'])): ?>
		<c:sed type="dateTime"><?php echo $product['sale_due'];?></c:sed>
		<?php endif; ?>
		<?php if(!empty($product['product_options'])): ?>
		<c:product_options type="string"><?php echo $product['product_options'];?></c:product_options>

		<?php endif; ?>
		<?php if(isset($product['extendedFields'])):?>
		<?php foreach($product['extendedFields'] as $name => $value): ?>
        <c:<?php echo $name; ?> type="string"><?php echo urlencode($value); ?></c:<?php echo $name; ?>>
		<?php endforeach; ?>
		<?php endif; ?>
		<g:availability>in stock</g:availability>
    </item>
    <?php endforeach; ?>
</channel>
</rss>